package com.mapper;

import com.entity.RoleAuthority;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author aiou
 * @since 2025-06-12
 */
@Mapper
public interface RoleAuthorityMapper{

    //删除角色权限表信息
    @Delete("delete from role_authority where role_id = #{roleId}")
    boolean deleteByRoleId(Integer roleId);

    //获取当前员工拥有的权限
    @Select("select * from role_authority where role_id = #{id}")
    List<RoleAuthority> selectRoleAuthorityById(Integer id);

    //保存用户权限
    @Insert("insert into role_authority(role_id,authority_id) values(#{roleId},#{authorityId})")
    boolean save(RoleAuthority roleAuthority);
}
